<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #grandpa {
      width: 400px;
      height: 400px;
      background-color: red;
    }

    #father {
      width: 300px;
      height: 300px;
      background-color: green;
    }

    #me {
      width: 200px;
      height: 200px;
      background-color: blue;
    }
  </style>
</head>
<body>
  <div id="app">
    <!-- 一、v-model指令的修饰符 -->

    <!-- number：把值转成数字，如果开头的字符是非数字，那么，依然是字符串；如果是后面有非数字，那么，去掉后面的非数字 -->
    <input type="text" v-model.number="count"><br />
    <!-- trim:去掉字符串前后的空格 -->
    <input type="text" v-model.trim="msg"><br />
    <!-- lazy:让事件变成change -->
    <input type="text" v-model.lazy="str"><br />

    <!-- 二、事件修饰符 -->

    <input type="button" value="按钮01" @click="fn01" />

    <div id="grandpa" @click="grandpaFn">
      <div id="father" @click.self.stop="fatherFn">
        <!-- <div id="father" @click.stop.self="fatherFn"> -->
        <div id="me" @click="meFn"></div>
      </div>
    </div>

    <!-- 三、事件修饰符_按键修饰符 -->

    <input type="text" @keyup.enter="keyupFn" />
    <input type="text" @keyup.13="keyupFn" />
    <input type="text" @keyup.left02="keyupFn02" />
    <br />
    <input type="text" @keyup.exact.ctrl.enter="send" />
    <input type="button" value="发送" @click="send" />
  </div>
  <script src="./js/vue.js"></script>
  <script>
    // 自定义键的别名
    Vue.config.keyCodes = {
      left02: 65
    }

    let vm = new Vue({
      el: "#app",
      data: {
        count: 1,
        msg: "hello",
        str: 'hi'
      },
      methods: {
        fn01() {
          console.log("heihei");
        },
        grandpaFn() {
          console.log("爷爷被点击了");
        },
        fatherFn() {
          console.log("父亲被点击了");
        },
        meFn(event) {
          // 获取音乐列表
          console.log("我被点击了");
        },
        keyupFn() {
          console.log("keyupFn");
        },
        keyupFn02() {
          console.log("a键被按下了");
        },
        send() {
          console.log("发送了信息");
        }
      }
    })

  </script>
</body>

</html>